<template>
	<view class="contain">
		<view style="position: relative;" class="teacher-item" v-for="item in teacList" :key="item.id"
			@tap="goDetail(item.id)">
			<view class="boxs">
				<view class="left">
					<image style="width: 154rpx; height: 205rpx;" :src="item.bareheadedPhoto" mode="">
					</image>
					<p>ID：{{item.code}}</p>
				</view>
				<view class="center">
					<view style="margin-bottom: 15rpx;">
						{{item.realName}}
						<image v-if="item.gender==2" style="width: 31rpx;
				height: 31rpx; vertical-align: middle; margin-left: 17rpx;" src="/static/image/women.png" mode=""></image>
						<image v-else style="width: 31rpx;
				height: 31rpx; vertical-align: middle; margin-left: 17rpx;" src="/static/image/man.png" mode=""></image>
					</view>
					<p class="school">{{item.graduateSchool}}</p>
					<view style="display: flex; align-items: center;position: absolute;">
						<p v-for="items in item.categoryList" :key="items.id" class="education">
							{{items.categoryName}},
						</p>
					</view>

					<view style="display: flex;align-items: center;margin-top: 50rpx;">
						<view :class="'grade'+ items.teachLv" class="grade"
							v-for="(items,index) in item.teacherCategoryConfigVOList">
							{{items.teachSubjectDetail}}
						</view>
					</view>
				</view>
			</view>
			<view class="right">
				<view>
					<image style="margin-right: 7rpx;" src="/static/image/rz.png" mode=""></image>
					<text>{{item.certification?'已认证' : '未认证'}}</text>
				</view>
				<view style="margin-top: 182rpx;">
					<image style="margin-right: 7rpx;width: 15rpx;
					height: 19rpx;" src="/static/image/address.png" mode=""></image>
					<text style="color: #000;">{{item.distance}}m</text>
				</view>
			</view>
			<view @tap.stop="quxiao(item.id)" style="position: absolute;bottom: 30rpx;left: 50%;transform: translate(-50%);">
				<view class="img">
					<text style="font-size: 26rpx;font-weight: bold;color: #FF6B55;">取消收藏</text>
				</view>
			</view>
		</view>
		<u-empty v-if="teacList.length===0" text="收藏为空" mode="list"></u-empty>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				teacList: []
			}
		},
		onShow() {
			this.getList()
		},
		methods: {
			async getList() {
				const res = await this.$u.api.getTeachPage({
					isCollect: 1,
					memberId: this.vuex_user.id,
					lat: uni.getStorageSync('lat'),
					lgt: uni.getStorageSync('lgt')
				})
				this.teacList = res.records
			},
			async quxiao(id) {
				console.log(id);
				const res = await this.$u.api.delLike({
					collectType: 1,
					objId: id
				})
				this.$u.toast('取消成功')
				this.getList()
			},
			goDetail(id){
				uni.navigateTo({
					url:`/pages/contradict/teacherDetail?teacherId=${id}`
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f7f7f7 !important;
	}
.img{
	background-image: url('https://xiyanluo.oss-cn-beijing.aliyuncs.com/%E8%8D%94%E8%87%B4%E5%AE%B6%E6%95%99/%E7%BB%84%2017%402x.png');
	background-repeat: no-repeat;
	background-size: cover;
	width: 224rpx;
	height: 67rpx;
	text-align: center;
	line-height: 67rpx;
	padding-left: 10rpx;
}
	.contain {
		padding: 0 30rpx;
	}

	.teacher-item {
		position: relative;
		display: flex;
		justify-content: space-between;
		margin-top: 40rpx;
		padding: 0 20rpx 0 32rpx;
		height: 438rpx;
		background: #FFFFFF;
		border-radius: 35rpx;

		&::after {
			content: '';
			display: block;
			width: 687rpx;
			height: 1rpx;
			background: #EEEEEE;
			position: absolute;
			bottom: 130rpx;
			left: 2rpx;
		}

		.boxs {
			display: flex;

			.left {
				text-align: center;
				margin-top: 30rpx;
				margin-right: 35rpx;

				p {
					margin-top: 20rpx;
					font-size: 20rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #999999;
				}
			}

			.center {
				margin-top: 40rpx;

				view {
					font-size: 34rpx;
					font-weight: bold;
					color: #323232;
					display: flex;
					align-items: center;

				}

				p {
					margin-top: 10rpx;
					font-size: 26rpx;
					font-weight: 500;
					color: #9D9D9D;
				}

				.grade {
					margin-top: 19rpx;
					width: 90rpx;
					height: 35rpx;
					line-height: 45rpx;
					padding-left: 12rpx;

					border-radius: 5rpx;
					font-size: 18rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					margin-right: 10rpx;
				}

				.grade18 {
					background: #ffbf55;
				}

				.grade21 {
					background: #be57ff;
				}

				.grade22 {
					background: #6a57ff;
				}
			}
		}


		.right {

			margin-top: 56rpx;

			view {
				display: flex;
				align-items: center;

				image {
					vertical-align: middle;
					width: 25rpx;
					height: 25rpx;
				}

				text {
					font-size: 22rpx;
					font-family: PingFang SC;
					font-weight: 500;
					color: #FF6054;
				}
			}

		}
	}
</style>